package com.zmn.oms.third.youzan;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author huangyifeng
 * @Description
 * @date 2020/4/27 17:18
 */
/**
 *  有赞渠道从CDS重新接入 2022-01-12
 */
@Deprecated
//@Component
public class YouzanConsts {

    public static final int CHANNEL_ID = 33975;  //渠道id
    public static final String CHANNEL_NAME = "有赞";

    /**
     * 接入参数
     */
    public static boolean POWER_ON;
    public static String SHOP_ID;   // 店铺id
    public static final String CLIENT_ID =  "1869af55673524cedc";  //商家id
    public static final String CLIENT_SECRET = "9d7984eda56d22448e25533120c8f086"; // 有赞应用secret

    /**
     * 接口地址
     */
    public static final String TOKEN_URL = "https://open.youzanyun.com/auth/token";  //有赞云access_token获取地址
    public static final String API_URL = "https://open.youzanyun.com/api/";  //有赞云api请求地址

    /**
     * 接口方法
     */
    public static final String API_METHOD_PULL_CLUES = "youzan.trades.sold.get/4.0.1";
    public static final String API_METHOD_ORDER_DETAIL = "youzan.trade.get/4.0.0";

    /**
     * 同步状态码
     */
    public static final int CODE_ORDER_VISITED = 1;     // 上门
    public static final int CODE_ORDER_COMPLETE = 2;    // 完成
    public static final int CODE_ORDER_CANCEL = 3;      // 取消

    /**
     * 获取状态码对应名称
     * @param code
     * @return
     */
    public static String getCodeName(int code) {
        switch (code) {
            case CODE_ORDER_COMPLETE:
                return "完成";
            case CODE_ORDER_CANCEL:
                return "取消";
            case CODE_ORDER_VISITED:
                return "上门";
            default:
                return String.format("未知状态：%s", String.valueOf(code));
        }
    }

    @Value("${youzan.power-on:false}")
    public  void setPowerOn(boolean powerOn){
        POWER_ON = powerOn;
    }

    @Value("${youzan.shop-id:46413499}")
    public  void setShopId(String shopId){
        SHOP_ID = shopId;
    }



}
